﻿namespace SLClient.ServiceAPI
{
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Runtime.Serialization;
    using System.Threading;

    [GeneratedCode("System.Runtime.Serialization", "4.0.0.0"), DebuggerStepThrough, DataContract(Name="OpenLotteryInfo", Namespace="http://schemas.datacontract.org/2004/07/SLClient")]
    public class OpenLotteryInfo : INotifyPropertyChanged
    {
        private DateTime CreateTimeField;
        private int IdField;
        private int LotteryCatagoryIdField;
        private string LotteryOpenIdField;
        private string OpenNumField;
        private DateTime OpenTimeField;
        private PropertyChangedEventHandler _PropertyChanged;

        public event PropertyChangedEventHandler PropertyChanged
        {
            add
            {
                PropertyChangedEventHandler handler2;
                PropertyChangedEventHandler propertyChanged = this._PropertyChanged;
                do
                {
                    handler2 = propertyChanged;
                    PropertyChangedEventHandler handler3 = (PropertyChangedEventHandler) Delegate.Combine(handler2, value);
                    propertyChanged = Interlocked.CompareExchange<PropertyChangedEventHandler>(ref this._PropertyChanged, handler3, handler2);
                }
                while (propertyChanged != handler2);
            }
            remove
            {
                PropertyChangedEventHandler handler2;
                PropertyChangedEventHandler propertyChanged = this._PropertyChanged;
                do
                {
                    handler2 = propertyChanged;
                    PropertyChangedEventHandler handler3 = (PropertyChangedEventHandler) Delegate.Remove(handler2, value);
                    propertyChanged = Interlocked.CompareExchange<PropertyChangedEventHandler>(ref this._PropertyChanged, handler3, handler2);
                }
                while (propertyChanged != handler2);
            }
        }

        protected void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler propertyChanged = this._PropertyChanged;
            if (propertyChanged != null)
            {
                propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public string BigOrLitter
        {
            get
            {
                string[] strArray = this.OpenNum.Split(new char[] { ',' });
                return (((Convert.ToInt32(strArray[strArray.Length - 1]) % 2) != 0) ? "单" : "双");
            }
        }

        [DataMember(Order=5)]
        public DateTime CreateTime
        {
            get
            {
                return this.CreateTimeField;
            }
            set
            {
                if (!this.CreateTimeField.Equals(value))
                {
                    this.CreateTimeField = value;
                    this.RaisePropertyChanged("CreateTime");
                }
            }
        }

        public string DanOrShuang
        {
            get
            {
                string[] strArray = this.OpenNum.Split(new char[] { ',' });
                return ((Convert.ToInt32(strArray[strArray.Length - 1]) >= 5) ? "大" : "小");
            }
        }

        [DataMember]
        public int Id
        {
            get
            {
                return this.IdField;
            }
            set
            {
                if (!this.IdField.Equals(value))
                {
                    this.IdField = value;
                    this.RaisePropertyChanged("Id");
                }
            }
        }

        [DataMember(Order=2)]
        public int LotteryCatagoryId
        {
            get
            {
                return this.LotteryCatagoryIdField;
            }
            set
            {
                if (!this.LotteryCatagoryIdField.Equals(value))
                {
                    this.LotteryCatagoryIdField = value;
                    this.RaisePropertyChanged("LotteryCatagoryId");
                }
            }
        }

        [DataMember]
        public string LotteryOpenId
        {
            get
            {
                return this.LotteryOpenIdField;
            }
            set
            {
                if (!object.ReferenceEquals(this.LotteryOpenIdField, value))
                {
                    this.LotteryOpenIdField = value;
                    this.RaisePropertyChanged("LotteryOpenId");
                }
            }
        }

        [DataMember(Order=3)]
        public string OpenNum
        {
            get
            {
                return this.OpenNumField;
            }
            set
            {
                if (!object.ReferenceEquals(this.OpenNumField, value))
                {
                    this.OpenNumField = value;
                    this.RaisePropertyChanged("OpenNum");
                }
            }
        }

        public string OpenNumsandCatagory
        {
            get
            {
                return (this.OpenNum + "," + this.LotteryCatagoryId);
            }
        }

        [DataMember(Order=4)]
        public DateTime OpenTime
        {
            get
            {
                return this.OpenTimeField;
            }
            set
            {
                if (!this.OpenTimeField.Equals(value))
                {
                    this.OpenTimeField = value;
                    this.RaisePropertyChanged("OpenTime");
                }
            }
        }
    }
}

